package com.saic.utils;

import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.SystemDefaultHttpClient;
import org.json.JSONObject;


public class HttpSaicUtils {
	
	
	/*
	 * 
	 */
	public static void doPost(String url,JSONObject json) throws Exception{
		//CloseableHttpClient httpClient =  new DefaultHttpClient();
		SystemDefaultHttpClient httpClient = new SystemDefaultHttpClient();
        HttpPost post = new HttpPost(url);
        try {
            StringEntity s = new StringEntity(json.toString());
            s.setContentEncoding("UTF-8");
            s.setContentType("application/json");//发送json数据需要设置contentType
            post.setEntity(s);
            httpClient.execute(post);
            httpClient.getConnectionManager().shutdown();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }


}
